<?php
namespace order\impl;
use order\Order;
use tool\Price;

class Normal extends Order {

    public function make_pre($pre_order)
    {
        $price=new Price();
        $goods_list=$pre_order['goods_list'];
        foreach ($goods_list as $_goods){

            $price->changeprice($_goods['price'],"购买{$_goods['name']} 数量:{$_goods['buynumber']}",$_goods['buynumber']);
        }
        $pre_order['price_list']=$price->getprice_list();
        $pre_order['totalprice']=$price->gettotalprice();

        return $pre_order;
    }

    public function make($order)
    {
        $price=new Price($order['price_list']);
        $order['price_list']=$price->getprice_list();
        $order['totalprice']=$price->gettotalprice();
        return $order;
    }

    public function notify($order)
    {
        $orderno=$order['orderno'];
        model("order")->where("orderno",$orderno)->update(["status"=>1,"ispay"=>1]);
        return "";
    }
}